/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Com.MakeReport_Case;

import Com.Entity.TransaksiKamar;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.List;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author Ardha
 */
public class DailyReportKamarTableModel extends AbstractTableModel {

    private List<TransaksiKamar> transaksi = new ArrayList<TransaksiKamar>();

    public DailyReportKamarTableModel(List<TransaksiKamar> transaksi) {
        this.transaksi = transaksi;
    }

    @Override
    public int getRowCount() {
        return transaksi.size();
    }

    @Override
    public int getColumnCount() {
        return 5;
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        TransaksiKamar transKamar = transaksi.get(rowIndex);
        NumberFormat number = NumberFormat.getCurrencyInstance();
        switch (columnIndex) {
            case 0:
                return transKamar.getNo_checkin();
            case 1:
                return transKamar.getNomor_kamar();
            case 2:
                return transKamar.getTanggalMasuk();
            case 3:
                return transKamar.getTanggalKeluar();
            case 4:
                return number.format(transKamar.getTotalHargaSewa());
            default:
                return "";
        }
    }

    @Override
    public String getColumnName(int column) {
        switch (column) {
            case 0:
                return "NO CHECKIN";
            case 1:
                return "NOMOR KAMAR";
            case 2:
                return "TANGGAL MASUK";
            case 3:
                return "TANGGAL KELUAR";
            case 4:
                return "TOTAL HARGA SEWA";
            default:
                return "";
        }
    }
}